﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Quba.Business.Services.Abstract.User;
using Quba.Business.Services.Concrete.User;
using Quba.Entities.Database.User;

namespace Quba.Tests.Business
{
    [TestClass]
    public class UserBusinessTests
    {
        private readonly ICandidateBusiness _candidateBusiness;
        private readonly IAdminBusiness _adminBusiness;
        public UserBusinessTests()
        {
            _candidateBusiness = new UserBusiness();
            _adminBusiness = new UserBusiness();
        }

        [TestMethod]
        public void CanAddAnAdmin()
        {
            var admin = new Admin
            {
                Username = "AirWatch-HR",
                Password = "AirWatch",
                CreatedBy = "SysAdmin",
                CreatedOn = DateTime.Now,
                ModifiedBy = "SysAdmin",
                ModifiedOn = DateTime.Now
            };
            var baseEntity = _adminBusiness.RegisterNewAdmin(admin);

            Assert.IsNotNull(baseEntity);
            Assert.IsTrue(baseEntity.Id > 0);
        }

        [TestMethod]
        public void CanGetAdminDetailsById()
        {
            var admin = _adminBusiness.GetAdminDetailsById(1);

            Assert.IsNotNull(admin);
            Assert.IsTrue(admin.Username ==  "AirWatch-HR");
        }

        [TestMethod]
        public void CanAddAnCandidate()
        {
            var candidate = new Candidate
            {
                FirstName = "Subhashish",
                LastName = "Pattajoshi",
                CreatedBy = "AirWatch-HR",
                CreatedOn = DateTime.Now,
                Email = "subhashishpattajoshi335@air-watch.com",
                MobileNumber = "9999999999",
                ModifiedBy = "AirWatch-HR",
                ModifiedOn = DateTime.Now
            };
            var baseEntity = _candidateBusiness.RegisterCandidate(candidate);

            Assert.IsNotNull(baseEntity);
            Assert.IsTrue(baseEntity.Id > 0);
        }

        [TestMethod]
        public void CanGetCandidateDetailsById()
        {
            var candidate = _candidateBusiness.GetCandidateDetailsById(1);

            Assert.IsNotNull(candidate);
            Assert.IsTrue(candidate.FirstName == "Subhashish");
        }

        
    }
}